package com.jams.goodox.entity;

import android.os.Parcel;
import android.os.Parcelable;

import com.jams.goodox.net.BaseEntity;

/**
 * Created by Jin on 2016/8/24.
 * Description
 */
public class CheckGoodsResult extends BaseEntity {
	/**
	 * redPacket : {"exchange":"满2.00可用","money":"20.00","redPacketId":"465798fe-69a0-11e6-a23e-00163e005381","redPacketType":"1","redPacketTypeName":"通用红包","validDate":"2016-09-10"}
	 * subPayType : 3
	 * productMoney : 10.0
	 * totalMoney : 10.00
	 * isExp : false
	 */

	private DataBean data;

	public DataBean getData() {
		return data;
	}

	public void setData(DataBean data) {
		this.data = data;
	}

	public static class DataBean implements Parcelable {
		/**
		 * exchange : 满2.00可用
		 * money : 20.00
		 * redPacketId : 465798fe-69a0-11e6-a23e-00163e005381
		 * redPacketType : 1
		 * redPacketTypeName : 通用红包
		 * validDate : 2016-09-10
		 */

		private RedPacket redPacket;//红包信息
		private int subPayType;//支付方式
		private String productMoney;//	产品总额
		private String totalMoney;//合计金额
		private boolean isExp;//是否需要运费
		private String discountPercent;

		public double getOnlinePayDiscount() {
			if (null == discountPercent)
				return 10.0;
			double d;
			try {
				d = Double.parseDouble(discountPercent);
			} catch (NumberFormatException e) {
				d = 10.0;
			}
			return d;
		}

		public double getOnlinePayDiscountNum() {
			return getOnlinePayDiscount() * 0.1;
		}

		public void setOnlinePayDiscount(String onlinePayDiscount) {
			this.discountPercent = onlinePayDiscount;
		}

		public RedPacket getRedPacket() {
			return redPacket;
		}

		public void setRedPacket(RedPacket redPacket) {
			this.redPacket = redPacket;
		}

		public int getSubPayType() {
			return subPayType;
		}

		public void setSubPayType(int subPayType) {
			this.subPayType = subPayType;
		}

		public String getProductMoney() {
			return productMoney;
		}

		public void setProductMoney(String productMoney) {
			this.productMoney = productMoney;
		}

		public String getTotalMoney() {
			return totalMoney;
		}

		public void setTotalMoney(String totalMoney) {
			this.totalMoney = totalMoney;
		}

		public boolean isIsExp() {
			return isExp;
		}

		public void setIsExp(boolean isExp) {
			this.isExp = isExp;
		}

		@Override
		public int describeContents() {
			return 0;
		}

		@Override
		public void writeToParcel(Parcel dest, int flags) {
			dest.writeSerializable(this.redPacket);
			dest.writeInt(this.subPayType);
			dest.writeString(this.productMoney);
			dest.writeString(this.totalMoney);
			dest.writeByte(this.isExp ? (byte) 1 : (byte) 0);
			dest.writeString(this.discountPercent);
		}

		public DataBean() {
		}

		protected DataBean(Parcel in) {
			this.redPacket = (RedPacket) in.readSerializable();
			this.subPayType = in.readInt();
			this.productMoney = in.readString();
			this.totalMoney = in.readString();
			this.isExp = in.readByte() != 0;
			this.discountPercent = in.readString();
		}

		public static final Creator<DataBean> CREATOR = new Creator<DataBean>() {
			@Override
			public DataBean createFromParcel(Parcel source) {
				return new DataBean(source);
			}

			@Override
			public DataBean[] newArray(int size) {
				return new DataBean[size];
			}
		};
	}
}
